/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author lzw
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface UpstreamDetails extends BasicModel<UpstreamDetails> {
  companyName?: string; // 公司名称
  appointBatchNum?: number; // 共委案次数
  appointCaseSumMoney?: number; // 总委案金额
  appointCaseSum?: number; // 委案总量
  appointCaseSumHouseholds?: number; // 委案总户数
  recycleSumMoney?: number; // 总回款金额
  recycleSumMoneyRatio?: string; // 回款比例
  maxBatch?: string; // 最高回款批次
  maxBatchMoney?: number; // 最高回款批次金额
  maxBatchRatio?: string; // 最高回款批次比例
  minBatch?: string; // 最低回款批次
  minBatchMoney?: number; // 最低回款批次金额
  minBatchRatio?: string; // 最低回款批次比例
  appName?: string; // app名称
}

export const upstreamDetailsList = (params?: UpstreamDetails | any) =>
  defHttp.get<UpstreamDetails>({ url: adminPath + '/operating/upstreamDetails/list', params });

export const upstreamDetailsListData = (params?: UpstreamDetails | any) =>
  defHttp.post<Page<UpstreamDetails>>({ url: adminPath + '/operating/upstreamDetails/listData', params });

export const upstreamDetailsForm = (params?: UpstreamDetails | any) =>
  defHttp.get<UpstreamDetails>({ url: adminPath + '/operating/upstreamDetails/form', params });

export const upstreamDetailsSave = (params?: any, data?: UpstreamDetails | any) =>
  defHttp.postJson<UpstreamDetails>({ url: adminPath + '/operating/upstreamDetails/save', params, data });

export const upstreamDetailsImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/operating/upstreamDetails/importData',
      onUploadProgress,
    },
    params,
  );

export const upstreamDetailsDelete = (params?: UpstreamDetails | any) =>
  defHttp.get<UpstreamDetails>({ url: adminPath + '/operating/upstreamDetails/delete', params });
